﻿@{
    ViewBag.Title = "已处理流程";
}
@section header{

}
<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-details" authorize="yes" onclick="btn_details()"><i class="fa fa-search-plus"></i>进度详情</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" name="txt_keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
@section scripts{
    <script>
        var baseUrl = "/flow/FlowInstances/";
        $(function () {
            gridList();
        })
        function gridList() {
            var $gridList = $("#gridList");
            $gridList.dataGrid({
                url: baseUrl + "FindAll?type=disposed",
                datatype: "json",
                height: $(window).height() - 128,
                mtype: "POST",
                colModel: [
                    { label: "主键", name: "ID", hidden: true, key: true },
                    {
                        label: "流程状态", name: "IsFinish", align: "center",
                        formatter: function (cellvalue, options, rowObject) {
                            if (cellvalue == 0) {
                                return "<span class=\"label label-info\">正在进行</span>";
                            } else if (cellvalue == 3) {
                                return "<span class=\"label label-danger\">不同意</span>";
                            } else if (cellvalue == 4) {
                                return "<span class=\"label label-warning\">被驳回</span>";
                            } else {
                                return "<span class=\"label label-success\">审批通过</span>";
                            }
                        }
                    },
                    { label: '实例名称', name: 'CustomName', align: 'left' },
                    { label: '实例编号', name: 'Code', align: 'left' },
                    { label: '当前节点名称', name: 'ActivityName', align: 'left' },
                    { label: '创建用户', name: 'CreateUserName', align: 'left' },
                    { label: '创建时间', name: 'AddTime', align: 'left' },
                ],
                rowNum: 20,
                rowList: [20, 50, 100],
                pager: '#gridPager',
                sortname: 'OrderBy',
                sortorder: "asc",
                viewrecords: true,
                autowidth: true,
                multiselect: true
            });
            $("#btn_search").click(function () {
                $gridList.jqGrid('setGridParam', {
                    postData: { keyword: $("#txt_keyword").val() },
                }).trigger('reloadGrid');
            });
        }
        function btn_details() {
            var keyValue = $("#gridList").jqGridRowValue().ID;
            $.modalOpen({
                id: "Details",
                title: "查看",
                url: baseUrl + "Details?keyValue=" + keyValue,
                width: "700px",
                height: "490px",
                btn: null,
            });
        }
    </script>
}